package com.test4;

import cn.hutool.core.codec.Base64;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zip.Test1;
import org.apache.commons.lang3.StringUtils;

import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.function.IntFunction;

public class SendText {

    // 定义字典树节点
    private static class TrieNode {

        private boolean isEndOfWord;

        private TrieNode[] children;

        public TrieNode() {
            isEndOfWord = false;
            children = new TrieNode[Character.MAX_VALUE + 1];
        }
    }

    private TrieNode root; // 字典树的根节点
    private Set<String> sensitiveWords; // 敏感词集合

    public SendText() {
        root = new TrieNode();
        sensitiveWords = new HashSet<>();
    }

    // 添加敏感词到字典树
    public void addSensitiveWord(String word) {
        TrieNode node = root;
        for (char c : word.toCharArray()) {
            if (node.children[c] == null) {
                node.children[c] = new TrieNode();
            }
            node = node.children[c];
        }
        node.isEndOfWord = true;
        sensitiveWords.add(word);
        System.err.println(node);
        System.err.println(root);
    }

    public static void main(String[] args) {
        String name = "啊啊啊";
        char a = '哈';
        System.err.println(Integer.valueOf(a));
//        SendText test = new SendText();
//        test.addSensitiveWord("卧槽");

    }

}
